/*
 * @lc app=leetcode.cn id=1431 lang=cpp
 *
 * [1431] 拥有最多糖果的孩子
 */

// @lc code=start
class Solution {
public:
    vector<bool> kidsWithCandies(vector<int>& candies, int extraCandies) {
        // 找到糖果最多是多少
        int max_candies {0};
        vector<bool> ok_candies(candies.size(), false);
        for(int i = 0; i < candies.size(); ++i)
        {
            max_candies = max(max_candies, candies[i]);
        }

        for(int i = 0; i < candies.size(); ++i)
        {
            if(candies[i] + extraCandies >= max_candies)
            {
                ok_candies[i] = true;
            }
        }

        return ok_candies;
    }
};
// @lc code=end

